#coding:utf-8
from django.contrib.auth.models import User
from rest_framework import serializers
from .models import *


class LoginSerializer(serializers.ModelSerializer):

    username = serializers.CharField(required=False, max_length=1024)
    password = serializers.CharField(required=False, max_length=1024)

    class Meta:
        model = User
        fields = ('id', 'username', 'password')

class UserSerializer(serializers.ModelSerializer):
    username = serializers.CharField(required=False, max_length=1024)
    email = serializers.CharField(required=False, max_length=1024)
    user_group = serializers.ListField()
    # permissions = serializers.ListField()

    class Meta:
        model = Project
        fields = ('id', 'username','email','user_group')


class ProjectSerializer(serializers.ModelSerializer):
    project_name = serializers.CharField(max_length=50)

    class Meta:
        model = Project
        fields = ('id', 'project_name')

class DeployProfileSerializer(serializers.ModelSerializer):
    deploy_type = serializers.CharField(required=False, max_length=1024)
    profile_name = serializers.CharField(required=False, max_length=1024)
    project = serializers.CharField(required=False, max_length=1024)
    interface_type = serializers.CharField(required=False, max_length=1024)
    interface_params = serializers.CharField(required=False, max_length=1024)

    class Meta:
        model = DeployProfile
        fields = ('id', 'deploy_type','profile_name','project','interface_type','interface_params')